package com.sdtele.tta.operation;


import java.util.HashMap;
import java.util.Map;
import com.sdtele.tta.dac.Dac;
import com.sdtele.tta.models.JsonRequest;
import com.sdtele.tta.models.JsonResponse;
import com.sdtele.tta.models.Task;
import com.sdtele.tta.utils.TaskUtils;

public class OperationGetTaskDetail extends Operation {
	
	public JsonResponse handle(JsonRequest jsonRequest) {
		System.out.println("OperationLogin:req="+jsonRequest);
		JsonResponse jres = new JsonResponse();
		//获取请求中携带的taskid
		long taskid = jsonRequest.getJsonObject().get("id").getAsLong();
		//获取该task 相关任务实体，任务附件，任务反馈
		Task task = Dac.getInstance().getTaskbyTaskid(taskid);
		Map<String, Object> taskMap = new HashMap<String, Object>();
		taskMap = TaskUtils.TaskToMap(task);
		TaskUtils.TaskAssemble(task, taskMap);
		
		
		if( taskMap.size()>0)
		{
			jres.setStatus(0);
			jres.setMessage("获取任务详细信息成功");
			jres.setEntity(taskMap);
		}else
		{
			jres.setStatus(1);
			jres.setMessage("获取任务详细信息失败");
		}
		
		return jres;
	
	}
   
}